package com.impzx.restaurant.rest.service;

import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.QueryParam;

import org.jboss.resteasy.annotations.Form;

import com.impzx.restaurant.rest.People;
import com.impzx.restaurant.rest.dataobject.DemoObject;

@Path("/demo")
public class DemoService {

	@Path("getStr")
	@GET
	public String simpleGetDemo(@QueryParam("id") String id) {
		return "id is " + id;
	}
	
	@GET
	@Path("getObj")
	public String simpleGetObject(@QueryParam("id") int id) {
		DemoObject obj = new DemoObject();
		obj.setId(id);
		return obj.toString();
	}
	
	@GET
	@Path("getObj2")
	public String mutileParamGetDemo(@QueryParam("id") int id, @QueryParam("name") String name) {
		DemoObject obj = new DemoObject();
		obj.setId(id);
		obj.setName(name);
		return obj.toString();
	}
	
	@POST
	@Path("postObj")
	public String simplePostDemo(@Form People people) {
		String result = "success";
		
		System.out.println(people.getName());
		System.out.println(people.getPassword());
		
		return result;
	}

	public String uploadFile() {
		return "";
	}
}
